#pragma once
#include "baseexception.h"
#include <string>

class PageError :
	public BaseException
{
private:
	std::string tableName;
	std::string errmsg;
	int errorNo;
public:
	PageError(std::string table, int err, std::string msg) : BaseException("Page error"), tableName(table), errorNo(err), errmsg(msg)
	{
		char buf[20];
		_itoa_s(errorNo, buf, 20, 10);
		errmsg = "Page error : " + errmsg + " " + buf + "\n";
	}
	virtual const char * what() const;
	virtual ~PageError(void);
};

class NullPointer :
	public BaseException
{
private:
	std::string errmsg;
	int errorNo;
public:
	NullPointer(std::string msg) : BaseException("Null pointer"), errmsg(msg), errorNo(0)
	{
		errmsg = "Null Pointer : " + errmsg + "\n";
	}
	virtual const char * what() const;
	virtual ~NullPointer(void);
};

class TableNotOpen :
	public BaseException
{
private:
	std::string tableName;
	std::string errmsg;
	int errorNo;
public:
	TableNotOpen(std::string table,std::string msg) : BaseException("Null pointer"), tableName(table), errmsg(msg), errorNo(0)
	{
		errmsg = "Table " +  tableName + " not open : " + errmsg + "\n";
	}
	virtual const char * what() const;
	virtual ~TableNotOpen(void);
};


class InvalidRecordId :
	public BaseException
{
private:
	std::string tableName;
	std::string errmsg;
	int errorNo;
public:
	InvalidRecordId(std::string table,std::string msg) : BaseException("InvalidRecordId"), tableName(table), errmsg(msg), errorNo(0)
	{
		errmsg = "Invalid RecordId in Table " +  tableName + " " + errmsg + "\n";
	}
	virtual const char * what() const;
	virtual ~InvalidRecordId(void);
};